package com.wf.netty.link;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;

/**
 * 功能描述
 *
 * @author wf
 * @since 2022/5/12
 */
public class ServerEncoder extends MessageToByteEncoder {
    @Override
    protected void encode(ChannelHandlerContext ctx, Object msg, ByteBuf out) throws Exception {
        System.out.println("step in to encode, msg is " + msg);
        out.writeInt(12);
        ctx.writeAndFlush(out);
    }
}
